
package com.nhc.model;

import com.astrob.activitys.GPSProvider;
import com.astrob.model.LonLat;
import com.astrob.naviframe.Start;
import com.astrob.util.CoordChange;
import com.astrob.util.SunRiseSet;
import com.astrob.util.SysUtils;
import com.astrob.util.Utils;
import com.nhc.database.dbmodel.TrackPoint;
import com.nhc.database.dbmodel.WayPoint;
import com.nhc.database.manager.DBDataCenter;
import com.nhc.database.manager.QiyaCenter;

import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import zuo.biao.library.base.BaseModel;

public class TripDatainfo extends BaseModel {

    private static final long serialVersionUID = 1L;

    public static final String DEDAUTSTR = "-----";
    //0~37
    public static String[] DATATYPE_NAMES = {
            "经纬度", "USER", "精度", "GPS高度", "方位",
            "航线方向", "偏航距", "返回航线", "预计到达", "预计在途",
            "当前目标", "当前距离", "最终距离", "最终目标", "最终到达",
            "最终在途", "航向", "方向指示", "当前速度", "最大速度",
            "平均运动", "旅行合计", "日期", "时间", "总里程",
            "里程表", "全程平均", "日出时间", "日落时间", "移动时间",
            "停止时间", "累计爬升", "累计下降", "有效速度", "垂直速度",
            "气压", "气压高度", "温度", "最高海拔", "最低海拔"};

    public String[] getInfo(int index) {

        String strC = "";
        String strUint = "";
        switch (index) {
            default:
            case 0:
                //经纬度
                if (longitude == 0) {
                    longitude = SysUtils.getInstance().getLL().GetLon();
                    latitude = SysUtils.getInstance().getLL().GetLat();
                }
                strC = SysUtils.getInstance().getLLStr(new LonLat(longitude, latitude));
                break;
            case 1:
                //USER--用户自定义的坐标系，坐标
                strC = getUser();
                break;
            case 2:
                //精度
                if (GPSProvider.getInstance() != null && GPSProvider.getInstance().isFixed()) {
                    accuracy = GPSProvider.getInstance().getAccuracy();
                    String DIS[] = SysUtils.getInstance().getAltitudeStr(accuracy);
                    strC = DIS[0];
                    strUint = DIS[1];
                } else {
                    accuracy = 0;
                    strC = DEDAUTSTR;
                }
                break;
            case 3: {
                //GPS高度
                int realaltitude = (int) altitude;
                if (GPSProvider.getInstance() != null && GPSProvider.getInstance().isFixed()) {
                    realaltitude = (int) GPSProvider.getInstance().getAltitude();
                }
                return SysUtils.getInstance().getDistanceStr(realaltitude);
            }
            case 4:
                //方位 car->B
                strC = getFWName();
                break;
            case 5:
                //航线方向 A->B
                strC = getHXFXName();
                break;
            case 6:
                //偏航距
                String DIS[] = SysUtils.getInstance().getDistanceStr((int)getPianhz());
                strC = DIS[0];
                strUint = DIS[1];
                break;
            case 7:
                //返回航线--返航角 航线与飞机最近距离位置的角度
                if (getFhhx() < 0) {
                    strC = DEDAUTSTR;
                } else {
                    strC = (int) getFhhx() + "";
                    strUint = " °";
                }
                break;
            case 8:
                //预计到达 到达时间
                if (Start.getInstance().isHavePath()) {
                    strC = getYujdaoda();
                } else {
                    strC = DEDAUTSTR;
                }
                break;
            case 9:
                //预计在途
                strC = getYujzt();
                break;
            case 10:
                //当前目标 目的地名称
                strC = getDqmb();
                break;
            case 11:
                //当前距离
                double dis = remainDistance;
                if (dqjl >= 0) {
                    dis = dqjl;
                }
                return SysUtils.getInstance().getDistanceStr((int) dis);
            case 12: {
                //最终距离
                double distace = remainDistance;
                if (DBDataCenter.getInstance().routeNavi != null && DBDataCenter.getInstance().routeNavi.waypointList != null) {
                    int destIndex = DBDataCenter.getInstance().routeNaviIndex;
                    int size = DBDataCenter.getInstance().routeNavi.waypointList.size();
                    WayPoint wpA = DBDataCenter.getInstance().routeNavi.waypointList.get(destIndex);
                    for (int i = destIndex + 1; i < size; i++) {
                        WayPoint wpB = DBDataCenter.getInstance().routeNavi.waypointList.get(i);
                        distace += Start.getInstance().MapKit().getDistance(wpA.getLL(), wpB.getLL());
                        wpA = wpB;
                    }
                }
                return SysUtils.getInstance().getDistanceStr((int) distace);
            }
            case 13:
                //最终目标
                strC = getZzmb();
                break;
            case 14:
                //最终到达
                if (Start.getInstance().isHavePath()) {
                    strC = getZZdaoda();
                } else {
                    strC = DEDAUTSTR;
                }
                break;
            case 15:
                //最终在途
                strC = getZZzt();
                break;
            case 16:
                //航向
                if (GPSProvider.getInstance() != null && GPSProvider.getInstance().isFixed()) {
                    dir = (int) GPSProvider.getInstance().getDirection();
                    if (CourseInfo.getInstance().getShowmode() == 1) {
                        strC = (int) dir + "";
                        strUint = " °";
                    } else {
                        strC = Utils.getDirName(dir);
                    }
                } else {
                    strC = DEDAUTSTR;
                }

                break;
            case 17:
                //方向指示
                if (GPSProvider.getInstance() != null && GPSProvider.getInstance().isFixed()) {
                    dir = (int) GPSProvider.getInstance().getDirection();
                    strC = Utils.getDirName(dir);
                } else {
                    strC = DEDAUTSTR;
                }
                break;
            case 18:
                //当前速度
                speed = 0;
                if (GPSProvider.getInstance() != null) {
                    speed = GPSProvider.getInstance().getSpeed();
                }
                return SysUtils.getInstance().getVelStr(speed);
            case 19:
                //最大速度
                return SysUtils.getInstance().getVelStr(maxvel);
            case 20:
                //平均运动速度
                return SysUtils.getInstance().getVelStr(averagevel);
            case 21: {
                //旅行合计 时间- GPS有效的定位时间
//                if (createtime == 0) {
//                    createtime = System.currentTimeMillis();
//                }
//                totaltime = (int) ((System.currentTimeMillis() - createtime) / 1000);
                strC = Utils.getTimeDF(totaltime);
            }
            break;
            case 22:
                //日期
                datetime = System.currentTimeMillis();
                strC = SysUtils.getInstance().getDateStr(datetime);
                break;
            case 23: {
                //时间
                datetime = System.currentTimeMillis();
                SimpleDateFormat formatter = new SimpleDateFormat(
                        "HH:mm:ss");
                Date curDate = new Date(datetime);
                strC = formatter.format(curDate);
            }
            break;
            case 24:
                //总里程
                return SysUtils.getInstance().getDistanceStr(totaldistance);
            case 25:
                //里程表
                return SysUtils.getInstance().getDistanceStr(tdistance);
            case 26: {
                //全程平均 速度
//                if (createtime == 0) {
//                    createtime = System.currentTimeMillis();
//                }
//                totaltime = (int) ((System.currentTimeMillis() - createtime) / 1000);
                int t = totaltime;
                if (totaltime == 0) {
                    t = 1;
                }
                return SysUtils.getInstance().getVelStr((double) (totaldistance / t));
            }
            case 27:
                //日出时间
//                strC = richutime;
                strC = SunRiseSet.getSunrise(getLL(), datetime);
                break;
            case 28:
                //日落时间
//                strC = riluotime;
                strC = SunRiseSet.getSunset(getLL(), datetime);
                break;
            case 29:
                //移动时间
                strC = Utils.getTimeDF(movingtime);
                break;
            case 30:
                //停止时间
//                if (createtime == 0) {
//                    createtime = System.currentTimeMillis();
//                }
//                totaltime = (int) ((System.currentTimeMillis() - createtime) / 1000);
                stoptime = totaltime - movingtime;
                strC = Utils.getTimeDF(stoptime);
                break;
            case 31:
                //累计爬升
                return SysUtils.getInstance().getAltitudeStr((int) cumulativeclimb);
            case 32:
                //累计下降
                return SysUtils.getInstance().getAltitudeStr((int) cumulativedecrease);
            case 33:
                //有效速度
                return SysUtils.getInstance().getVelStr(speed);
            case 34:
                //垂直速度
                return SysUtils.getInstance().getVelStr(vvel);
            case 35:
                //气压
                return SysUtils.getInstance().getQiyaStr(qiya);
            case 36: {
                //气压高度
                double alt = 0;
                if (QiyaCenter.getInstance()._thisQiyaInfo != null) {
                    alt = QiyaCenter.getInstance()._thisQiyaInfo.getAltitude();
                }
                return SysUtils.getInstance().getDistanceStr((int) alt);
            }
            case 37: {
                //温度
                double wen = wendu + SensorSetInfo.getInstance().getWenduX();
                return SysUtils.getInstance().getWenduStr(wen);
            }
            case 38:
                //最高海拔高度
                return SysUtils.getInstance().getDistanceStr((int) getAltitudemax());
            case 39:
                //最低海拔高度
                return SysUtils.getInstance().getDistanceStr((int) getAltitudemin());
        }

        String[] SS = {strC, strUint};
        return SS;
    }

    public String[] getInfoForCompass(int index) {
        return getInfo(index);
    }

    public String[] getInfoForQiya(int index) {
        return getInfo(index);
    }

    public int[] DATATYPE_INDEXS = {24, 21, 29, 30, 18, 20, 31, 32};//默认

    public int[] DATATYPE_INDEXS_COMPASS = {18, 16, 4, 17};//默认

    public int[] DATATYPE_INDEXS_QIYA = {31, 38};//默认36

    private String user = "";//USER
    private double longitude = 0;//经度
    private double latitude = 0;//纬度
    private double altitude = 0;//海拔高度
    private double altitudemax = -1000000;//最高海拔高度
    private double altitudemin = 1000000;//最低海拔高度
    private double speed = 0;//速度 米／秒
    private double dir = 0;//方向
    private double accuracy = 0;//精度 米
    private long datetime = 0; //时间

    private String dirname = "";//方向指示

    private int totaldistance; //总里程 米
    private int totaltime; //旅行合计（总时间） 秒
    private int movingtime; //移动时间 秒
    private int stoptime; //停止时间 秒
    private float maxvel; //最大速度 米／秒
    private float averagevel; //平均运动速度 米／秒
    private float cumulativeclimb; //累计爬升 米
    private float cumulativedecrease; //累计下降 米

    private float vvel; //垂直速度

    private String datename = "";//日期
    private String timename = "";//时间

    private String richutime = "";//日出时间
    private String riluotime = "";//日落时间
    private double qiya = 0; //气压 帕
    private double wendu = 0; //温度

    public long starttime = 0; //启动时间--GPS有效
    private int tdistance; //里程表 米 --- 重启后清0

    public long createtime = 0;//行程创建时间， 只能手动清空

    //需有path
    private double dirC2B = 0;//方位 car->B
    private double dirA2B = 0;//航线方向A->B

    private double pianhz = 50;//偏航距 米
    private double fhhx = 0;//返回航线--返航角
    private long yujdaDateTime = 0;//预计到达时间
    private int yujztTime = 0;//预计在途 秒

    private String dqmb = "";//当前目标名称
    private double dqjl = 0;//当前距离--剩余距离
    private String zzmb = "";//最终目标名称
    private double zzjl = 0;//最终距离

    private long zzddaDateTime = 0;//最终到达时间
    private int zzztTime = 0;//最终在途 秒

    private double remainDistance = 0;//剩余距离

    /**
     * 默认构造方法，JSON等解析时必须要有
     */
    public TripDatainfo() {
        //default
    }

    public TripDatainfo(long id) {
        this();
        this.id = id;
    }

    public void reset() {
        totaldistance = 0; //总里程 米
        totaltime = 0; //总时间 秒
        movingtime = 0; //移动时间 秒
        stoptime = 0; //停止时间 秒
        averagevel = 0; //平均速度
        cumulativeclimb = 0; //累计爬升 米
        cumulativedecrease = 0; //累计下降 米

        user = "";//USER
        altitude = 0;//海拔高度
        speed = 0;//速度 米／秒
        dir = 0;//方向
        accuracy = 0;//精度 米
        dirname = "";//方向指示
        totaltime = 0; //旅行合计（总时间） 秒
        movingtime = 0; //移动时间 秒
        stoptime = 0; //停止时间 秒
        maxvel = 0; //最大速度 米／秒
        averagevel = 0; //平均运动速度 米／秒
        cumulativeclimb = 0; //累计爬升 米
        cumulativedecrease = 0; //累计下降 米

        vvel = 0; //垂直速度
        datename = "";//日期
        timename = "";//时间

        richutime = "";//日出时间
        riluotime = "";//日落时间
        qiya = 0; //气压
        wendu = 0; //温度

        starttime = 0; //启动时间--GPS有效
        tdistance = 0; //里程表 米 --- 重启后清0
        createtime = 0;//行程创建时间， 只能手动清空

        yujdaDateTime = 0;
        zzddaDateTime = 0;
        zzztTime = 0;

        altitudemax = -1000000;//最高海拔高度
        altitudemin = 1000000;//最低海拔高度

    }

    public LonLat getLL() {
        return new LonLat(longitude, latitude);
    }

    public Map<String, String> getTotaldistancestr() {
        DecimalFormat DF = new DecimalFormat("00.0");
        String strDistance, strUnit;
        if (totaldistance >= 10000) {
            strDistance = new DecimalFormat("00").format(totaldistance / 1000);
            strUnit = "km";
        } else if (totaldistance >= 1000) {
            strDistance = new DecimalFormat("00.0").format(totaldistance / 1000.0);
            strUnit = "km";
        } else {
            strDistance = new DecimalFormat("00").format(totaldistance);
            strUnit = "m";
        }

        Map<String, String> tdisMap = new HashMap<String, String>();
        tdisMap.put("distance", strDistance);
        tdisMap.put("unit", strUnit);
        return tdisMap;
    }

    public String getTotaltimestr() {
        DecimalFormat DF = new DecimalFormat("00");
        return DF.format(totaltime / 60) + ":" + DF.format(totaltime % 60);
    }

    public String getMovingtimestr() {
        DecimalFormat DF = new DecimalFormat("00");
        return DF.format(movingtime / 60) + ":" + DF.format(movingtime % 60);
    }

    public String getStoptimestr() {
        DecimalFormat DF = new DecimalFormat("00");
        return DF.format(stoptime / 60) + ":" + DF.format(stoptime % 60);
    }

    public String getCurrentvelstr() {
        return new DecimalFormat("00.0").format(getSpeed());
    }

    public String getAveragevelstr() {
        return new DecimalFormat("00.0").format(averagevel);
    }

    public String getCumulativeclimbstr() {
        return new DecimalFormat("00.0").format(cumulativeclimb);
    }

    public String getCumulativedecreasestr() {
        return new DecimalFormat("00.0").format(cumulativedecrease);
    }

    public int getTotaldistance() {
        return totaldistance;
    }

    public void setTotaldistance(int totaldistance) {
        this.totaldistance = totaldistance;
    }

    public int getTotaltime() {
        return totaltime;
    }

    public void setTotaltime(int totaltime) {
        this.totaltime = totaltime;
    }

    public void addTotaltime() {
        this.totaltime++;
    }

    public int getMovingtime() {
        return movingtime;
    }

    public void setMovingtime(int movingtime) {
        this.movingtime = movingtime;
    }

    public int getStoptime() {
        return stoptime;
    }

    public void setStoptime(int stoptime) {
        this.stoptime = stoptime;
    }

    public double getCurrentvel() {
        return getSpeed();
    }

    public float getAveragevel() {
        return averagevel;
    }

    public void setAveragevel(float averagevel) {
        this.averagevel = averagevel;
    }

    public float getCumulativeclimb() {
        return cumulativeclimb;
    }

    public void setCumulativeclimb(float cumulativeclimb) {
        this.cumulativeclimb = cumulativeclimb;
    }

    public float getCumulativedecrease() {
        return cumulativedecrease;
    }

    public void setCumulativedecrease(float cumulativedecrease) {
        this.cumulativedecrease = cumulativedecrease;
    }

    public String getUser() {
        if (SysUtils.getInstance().getLL().IsInvalid()) {
            user = DEDAUTSTR;
            return user;
        }
        HCLocationInfo hcl = CoordChange.getInstance().getHCL(4, SysUtils.getInstance().getLL(), 4);
        Map<String, String> DMS = hcl.getLLStr();
        user = DMS.get("lat") + " " + DMS.get("lon");
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    public void setCurrentTp(TrackPoint currentTp) {
//        totaltime = (int) ((this.datetime - createtime) / 1000);
        stoptime = totaltime - movingtime;

        if (currentTp == null)
            return;

        if (createtime == 0) {
            createtime = currentTp.getDatetime();
        }
        if (starttime == 0) {
            starttime = currentTp.getDatetime();
            tdistance = 0;
        }

        double longitude = currentTp.getLongitude();//经度
        double latitude = currentTp.getLatitude();//纬度
        double altitude = currentTp.getAltitude();//海拔高度
        double speed = currentTp.getSpeed();//速度 米／秒 => *3.6 公里/小时
        double dir = currentTp.getDir();//方向
        double accuracy = currentTp.getAccuracy();//精度 米
        long datetime = currentTp.getDatetime(); //时间

        LonLat ll = new LonLat(longitude, latitude);
        if (!ll.IsValid()) {
            return;
        }
        double distance = 0;
        if (getLL().IsValid()) {
            distance = Start.getInstance().MapKit().getDistance(ll, getLL());
        }

        totaldistance += distance;
        tdistance += distance;
        if (speed * 3.6 > 1) {
            movingtime++;
        }

        if (maxvel < speed) {
            maxvel = (float) speed;
        }

        if (averagevel > 0) {
            averagevel = (float) (averagevel + speed) / 2;
        } else {
            averagevel = (float) speed;
        }

        float xx = (float) (altitude - this.altitude);

        if (Math.abs(xx) < 5) {
            vvel = 0;//高度差低于5米，则不改变高度
        } else {
            if (xx > 0) {
                cumulativeclimb += xx;
            } else {
                cumulativedecrease -= xx;
            }
            this.altitude = altitude;//海拔高度
        }

        if (altitude > this.altitudemax) {
            this.altitudemax = altitude;
        }

        if (altitude < this.altitudemin) {
            this.altitudemin = altitude;
        }
        
        vvel = (float) (Math.abs(xx) / (this.datetime - datetime) / 1000);

        this.longitude = longitude;//经度
        this.latitude = latitude;//纬度
        this.speed = speed;//速度 米／秒 => *3.6 公里/小时
        this.dir = dir;//方向
        this.accuracy = accuracy;//精度 米
        this.datetime = datetime; //时间
    }

    public String getDirname() {
        return dirname;
    }

    public void setDirname(String dirname) {
        this.dirname = dirname;
    }

    public float getMaxvel() {
        return maxvel;
    }

    public void setMaxvel(float maxvel) {
        this.maxvel = maxvel;
    }

    public float getVvel() {
        return vvel;
    }

    public void setVvel(float vvel) {
        this.vvel = vvel;
    }

    public String getDatename() {
        return datename;
    }

    public void setDatename(String datename) {
        this.datename = datename;
    }

    public String getTimename() {
        return timename;
    }

    public void setTimename(String timename) {
        this.timename = timename;
    }

    public String getRichutime() {
        return richutime;
    }

    public void setRichutime(String richutime) {
        this.richutime = richutime;
    }

    public String getRiluotime() {
        return riluotime;
    }

    public void setRiluotime(String riluotime) {
        this.riluotime = riluotime;
    }

    public double getQiya() {
        return qiya;
    }

    public void setQiya(double qiya) {
        this.qiya = qiya;
    }

    public double getWendu() {
        return wendu;
    }

    public void setWendu(double wendu) {
        this.wendu = wendu;
    }

    public long getStarttime() {
        return starttime;
    }

    public void setStarttime(long starttime) {
        this.starttime = starttime;
    }

    public double getDirC2B() {
        return dirC2B;
    }

    public void setDirC2B(double dirC2B) {
        this.dirC2B = dirC2B;
    }

    public double getDirA2B() {
        return dirA2B;
    }

    public void setDirA2B(double dirA2B) {
        this.dirA2B = dirA2B;
    }

    public double getPianhz() {
        return pianhz;
    }

    public void setPianhz(double pianhz) {
        this.pianhz = pianhz;
    }

    public double getFhhx() {
        return fhhx;
    }

    public void setFhhx(double fhhx) {
        this.fhhx = fhhx;
    }

    public long getYujdaDateTime() {
        return yujdaDateTime;
    }

    public void setYujdaDateTime(long yujdaDateTime) {
        this.yujdaDateTime = yujdaDateTime;
    }

    public int getYujztTime() {
        return yujztTime;
    }

    public void setYujztTime(int yujztTime) {
        this.yujztTime = yujztTime;
    }

    public String getDqmb() {
        String fw = DEDAUTSTR;
        if (!Start.getInstance().isHavePath()) {
            return fw;
        }

        if (Start.getInstance().MapKit().mNavDest == null) {
            return fw;
        }

        String ss = dqmb;
        if (dqmb == null || dqmb.length() < 1) {
            ss = Start.getInstance().MapKit().mNavDest[0].name;
        }
        return ss;
    }

    public void setDqmb(String dqmb) {
        this.dqmb = dqmb;
    }

    public double getDqjl() {
        return dqjl;
    }

    public void setDqjl(double dqjl) {
        this.dqjl = dqjl;
    }

    public String getZzmb() {
        String fw = DEDAUTSTR;
        if (!Start.getInstance().isHavePath()) {
            return fw;
        }

        if (DBDataCenter.getInstance().routeNavi != null && DBDataCenter.getInstance().routeNavi.waypointList != null) {
            int size = DBDataCenter.getInstance().routeNavi.waypointList.size();
            WayPoint wp = DBDataCenter.getInstance().routeNavi.waypointList.get(size - 1);
            zzmb = wp.getName();
        } else if (Start.getInstance().MapKit().mNavDest != null && Start.getInstance().MapKit().mNavDest.length > 0) {
            zzmb = Start.getInstance().MapKit().mNavDest[0].name;
        }

        return zzmb;
    }

    public void setZzmb(String zzmb) {
        this.zzmb = zzmb;
    }

    public double getZzjl() {
        return zzjl;
    }

    public void setZzjl(double zzjl) {
        this.zzjl = zzjl;
    }

    public long getZzddaDateTime() {
        return zzddaDateTime;
    }

    public void setZzddaDateTime(long zzddaDateTime) {
        this.zzddaDateTime = zzddaDateTime;
    }

    public int getZzztTime() {
        return zzztTime;
    }

    public void setZzztTime(int zzztTime) {
        this.zzztTime = zzztTime;
    }

    public int getTdistance() {
        return tdistance;
    }

    public void setTdistance(int tdistance) {
        this.tdistance = tdistance;
    }

    public double getLongitude() {
        return longitude;
    }

    public void setLongitude(double longitude) {
        this.longitude = longitude;
    }

    public double getLatitude() {
        return latitude;
    }

    public void setLatitude(double latitude) {
        this.latitude = latitude;
    }

    public double getAltitude() {
        return altitude;
    }

    public void setAltitude(double altitude) {
        this.altitude = altitude;
    }

    public double getAltitudemax() {
        if (altitudemax == -1000000) {
            return 0;
        }
        return altitudemax;
    }

    public void setAltitudemin(double altitude) {
        this.altitudemin = altitude;
    }

    public double getAltitudemin() {
        if (altitudemin == 1000000) {
            return 0;
        }
        return altitudemin;
    }

    public void setAltitudemax(double altitude) {
        this.altitudemax = altitude;
    }

    public double getSpeed() {
        return speed;
    }

    public void setSpeed(double speed) {
        this.speed = speed;
    }

    public double getDir() {
        return dir;
    }

    public void setDir(double dir) {
        this.dir = dir;
    }

    public double getAccuracy() {
        return accuracy;
    }

    public void setAccuracy(double accuracy) {
        this.accuracy = accuracy;
    }

    public long getDatetime() {
        return datetime;
    }

    public void setDatetime(long datetime) {
        this.datetime = datetime;
    }

    public double getRemainDistance() {
        return remainDistance;
    }

    public void setRemainDistance(double remainDistance) {
        this.remainDistance = remainDistance;
    }

    /**
     * 以下getter和setter可以自动生成
     * <br>  eclipse: 右键菜单 > Source > Generate Getters and Setters
     * <br>  android studio: 右键菜单 > Generate > Getter and Setter
     */


    @Override
    protected boolean isCorrect() {//根据自己的需求决定，也可以直接 return true
        return id > 0;// && StringUtil.isNotEmpty(phone, true);
    }

    private String getFWName() {
        //方位 car->B
        String fw = DEDAUTSTR;
        if (!Start.getInstance().isHavePath()) {
            return fw;
        }

        if (Start.getInstance().MapKit().mNavDest == null) {
            return fw;
        }

        LonLat carLL = SysUtils.getInstance().getLL();
        carLL = Utils.wgs84togcj02(carLL.GetLon(), carLL.GetLat());//Utils GPS to 火星坐标
        double lon = Start.getInstance().MapKit().mNavDest[0].pos.lon;
        double lat = Start.getInstance().MapKit().mNavDest[0].pos.lat;

        return Start.getInstance().MapKit().getDirection(carLL, new LonLat(lon, lat));
    }

    private String getHXFXName() {
        //航线方向 A->B
        String fw = DEDAUTSTR;
        if (!Start.getInstance().isHavePath()) {
            return fw;
        }

        if (Start.getInstance().MapKit().mNavDest == null
                || Start.getInstance().MapKit().mNavStart == null) {
            return fw;
        }

        double lon = Start.getInstance().MapKit().mNavStart.pos.lon;
        double lat = Start.getInstance().MapKit().mNavStart.pos.lat;

        LonLat startLL = new LonLat(lon, lat);
        lon = Start.getInstance().MapKit().mNavDest[0].pos.lon;
        lat = Start.getInstance().MapKit().mNavDest[0].pos.lat;

        return Start.getInstance().MapKit().getDirection(startLL, new LonLat(lon, lat));
    }

    private String getYujzt() {
        double speedcal = 40.0;
        if (speedcal < averagevel) {
            speedcal = averagevel;
        }

        // km/h - > m/s
        speedcal = speedcal * 1000 / 3600;

        if (SysUtils.getInstance().navi_mode2 == 1) {
            // 步行速度 3 米/秒
            speedcal = 3;
        }

        double dis = remainDistance;
        if (dqjl >= 0) {
            dis = dqjl;
        }

        int ArrivalTime = (int) (dis / speedcal); // s
        return Utils.getTimeDF(ArrivalTime);
    }

    private String getYujdaoda() {
        double speedcal = 40.0;
        if (speedcal < averagevel) {
            speedcal = averagevel;
        }

        // km/h - > m/s
        speedcal = speedcal * 1000 / 3600;

        if (SysUtils.getInstance().navi_mode2 == 1) {
            // 步行速度 3 米/秒
            speedcal = 3;
        }

        double dis = remainDistance;
        if (dqjl >= 0) {
            dis = dqjl;
        }

        long ArrivalTime = (long) (dis / speedcal); // s
        ArrivalTime = ArrivalTime * 1000 + System.currentTimeMillis();
        SimpleDateFormat formatter = new SimpleDateFormat("HH:mm");
        Date date = new Date(ArrivalTime);

        return formatter.format(date);
    }


    private String getZZzt() {
        double distace = remainDistance;
        if (DBDataCenter.getInstance().routeNavi != null && DBDataCenter.getInstance().routeNavi.waypointList != null) {
            int destIndex = DBDataCenter.getInstance().routeNaviIndex;
            int size = DBDataCenter.getInstance().routeNavi.waypointList.size();
            WayPoint wpA = DBDataCenter.getInstance().routeNavi.waypointList.get(destIndex);
            for (int i = destIndex + 1; i < size; i++) {
                WayPoint wpB = DBDataCenter.getInstance().routeNavi.waypointList.get(i);
                distace += Start.getInstance().MapKit().getDistance(wpA.getLL(), wpB.getLL());
                wpA = wpB;
            }
        }

        double speedcal = 40.0;
        if (speedcal < averagevel) {
            speedcal = averagevel;
        }

        // km/h - > m/s
        speedcal = speedcal * 1000 / 3600;

        if (SysUtils.getInstance().navi_mode2 == 1) {
            // 步行速度 3 米/秒
            speedcal = 3;
        }

        double dis = distace;

        int ArrivalTime = (int) (dis / speedcal); // s
        return Utils.getTimeDF(ArrivalTime);
    }

    private String getZZdaoda() {
        double distace = remainDistance;
        if (DBDataCenter.getInstance().routeNavi != null && DBDataCenter.getInstance().routeNavi.waypointList != null) {
            int destIndex = DBDataCenter.getInstance().routeNaviIndex;
            int size = DBDataCenter.getInstance().routeNavi.waypointList.size();
            WayPoint wpA = DBDataCenter.getInstance().routeNavi.waypointList.get(destIndex);
            for (int i = destIndex + 1; i < size; i++) {
                WayPoint wpB = DBDataCenter.getInstance().routeNavi.waypointList.get(i);
                distace += Start.getInstance().MapKit().getDistance(wpA.getLL(), wpB.getLL());
                wpA = wpB;
            }
        }

        double speedcal = 40.0;
        if (speedcal < averagevel) {
            speedcal = averagevel;
        }

        // km/h - > m/s
        speedcal = speedcal * 1000 / 3600;

        if (SysUtils.getInstance().navi_mode2 == 1) {
            // 步行速度 3 米/秒
            speedcal = 3;
        }
        
        double dis = distace;

        long ArrivalTime = (long) (dis / speedcal); // s
        ArrivalTime = ArrivalTime * 1000 + System.currentTimeMillis();
        SimpleDateFormat formatter = new SimpleDateFormat("HH:mm");
        Date date = new Date(ArrivalTime);

        return formatter.format(date);
    }



}
